home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / DirectShow / Capture / DVApp / dbgsup.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  1.6 KB  |  62 lines

  1. //------------------------------------------------------------------------------
  2. // File: DbgSup.h
  3. //
  4. // Desc: DirectShow sample code - DV control/capture example
  5. //       Debug macros and supporting functions for Windows programs
  6. //
  7. // Copyright (c) 2000-2001 Microsoft Corporation.  All rights reserved.
  8. //------------------------------------------------------------------------------
  9.  
  10. #ifdef _DEBUG
  11.  
  12. // dump a string to debug output
  13. #define Dump(tsz) \
  14.     OutputDebugString(tsz)
  15.  
  16. // dump a string with a parameter value to debug output
  17. TCHAR dbgsup_tszDump[256];
  18. #define Dump1(tsz, arg) \
  19.     { wsprintf(dbgsup_tszDump, (tsz), (arg)); \
  20.       OutputDebugString(dbgsup_tszDump); }
  21.  
  22.  
  23. #define CHECK_ERROR(tsz,hr)                     \
  24. {   if( S_OK != hr)                             \
  25.     {                                           \
  26.         wsprintf(dbgsup_tszDump, (tsz), (hr));  \
  27.         OutputDebugString(dbgsup_tszDump);      \
  28.         return hr;                              \
  29.     }                                           \
  30. }
  31.     
  32. #ifndef DBGSUPAPI
  33. #define DBGSUPAPI __declspec(dllimport)
  34. #endif
  35.  
  36. // dump a Windows message to debug output
  37. DBGSUPAPI void DumpMsg(
  38.     UINT msg,
  39.     WPARAM wparam,
  40.     LPARAM lparam);
  41.  
  42.  
  43. #include <assert.h>
  44.  
  45. // assert an expression
  46. #define Assert(exp)     assert(exp)
  47.  
  48. #else
  49.  
  50. // do nothing in retail version
  51. #define Dump(sz)
  52. #define Dump1(sz, arg)
  53. #define DumpMsg(msg, wp, lp)
  54. #define Assert(exp)
  55.  
  56. #define CHECK_ERROR(tsz,hr)                     \
  57. {   if( S_OK != hr)                             \
  58.         return hr;                              \
  59. }
  60.  
  61. #endif  // _DEBUG
  62.